// 字符串样式转对象
export function styleStrToObject(style) {
  const obj = {};
  const styleArr = style.split(";").map((item) => item.trim());

  styleArr.forEach((prop) => {
    let [key, value] = prop.split(":");
    const jsKey = key
      .split("-")
      .map((word, index) => {
        return index === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1);
      })
      .join("");
    obj[jsKey] = value.trim() || value;
  });
  return obj;
}

// 验证对象是否为空
export function isEmptyObject(value = {}) {
  return !!Object.keys(value).length;
}
